<?php
namespace bee;
require "autoLoader.php";


/**
 *
 * @author dzelenika
 * @abstract main config class
 * only this class should be accessed from application
 *
 */
final class config
{

  private static  $__instance           = NULL;
  const BEE_PATH                        = "D:/razvoj/sites/bee3OS";
  const APPLICATION_PATH                = config::BEE_PATH . "/application";   //                   ;//= $this->BEE_PATH . "/application";
  const TEMPLATE_PATH                   = config::BEE_PATH . "/template";
  const LIBRARY_PATH                    = config::BEE_PATH . "/library";
  const CONFIG_PATH                     = config::BEE_PATH . "/config";


  //private $dispatchLevel;                 //= eventDispatcher::DISPATCH_ONLY_REFISTERED ;

  private function __construct()
  {

    //$this->APP_PATH                        = $this->BEE_PATH . "/application";
    //$this->LIBRARY_PATH                    = $this->BEE_PATH . "/library";
/*
    set_include_path(get_include_path()     . PATH_SEPARATOR . $this->LIBRARY_PATH
                                            . PATH_SEPARATOR . $this->CONFIG_PATH
                                            . PATH_SEPARATOR . $this->LIBRARY_PATH . "/interface"
                                            . PATH_SEPARATOR . $this->LIBRARY_PATH . "/trait");
*/
/*
    set_include_path(get_include_path()     . PATH_SEPARATOR . config::LIBRARY_PATH
    . PATH_SEPARATOR . config::CONFIG_PATH
    . PATH_SEPARATOR . config::LIBRARY_PATH . "/interface"
      . PATH_SEPARATOR . config::LIBRARY_PATH . "/trait");
      */
//die(get_include_path());

    $this->dispatchLevel                 = eventDispatcher::DISPATCH_ONLY_REFISTERED ;
  }


  public function getSetting($name)
  {
  	if(isset($this->$name))
  	{
  		return $this->$name;
  	}
  	throw new exception("Setting $name not found", 6969);
  }

  public static function getInstance()
  {
		return static::$__instance ?: static::$__instance = new config();
	}

  /**
   *
   * @throws exception
   */
	public function __clone()
	{
		throw new exception("Cloning ". __CLASS__. " is not allowed.", 6969);
	}


	use coreConfig;
  use systemConfig;
	use applicationConfig;
	//use defines;

	const SYS_DISPATCH_LEVEL              = "sys_dispatchLevel";




	const APP_START_PAGE                  = "app_startPage";
	const APP_START_PAGE_TYPE             = "app_startPageType";


/*
	const PAGE_TYPE_FORM                  = 1;
	const PAGE_TYPE_PAGE                  = 2;
	const PAGE_TYPE_SPECIAL               = 3;
	const PAGE_TYPE_SPECIAL_APP           = 4;
*/
}

